<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/9
 * Time: 22:27
 */

namespace app\api\validate;


class IDCollectionValidate extends BaseValidate
{
    protected $rule =[
        'ids' => 'require|checkIDs'
    ];
    protected $message = [
        'ids'=>'id参数不必须是于逗号分割的字符串'
    ];
    public function checkIDs($value){
        $value = explode(',',$value);
        if(empty($value)){
            return false;
        }
        foreach ($value as $id) {
            if(!$this->isPositiveInteger($id)){
                return false;
            }
        }
        return true;
    }
}